﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="GroupEditor.aspx.cs" Inherits="Contacts.Web.GroupEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

   <h2 class="h2Style">
   The editing form:
   <asp:Label ID="lblWorning" runat="server" Text="" ForeColor="Red"></asp:Label>
   <asp:Label ID="lblGroupID" runat="server" Text=""></asp:Label>
   </h2>
         
      <div id="formSection">
         <div id="offerForm">


   <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" ValidationGroup="GroupReq" />
   <asp:ValidationSummary ID="ValidationSummary2" runat="server" ForeColor="Red" ValidationGroup="Icon" />

   <table border="1" style="margin-left:auto; margin-right:auto; width:60%;">

      <tr>
         <td>Имя Группы:</td>
         <td>
         <asp:TextBox ID="ttGroupName" runat="server" Width="178px"></asp:TextBox>
            <asp:RequiredFieldValidator ID="validGroupName" ForeColor="Red" runat="server" 
               ErrorMessage="Введите имя группы" ControlToValidate="ttGroupName" ValidationGroup="GroupReq">*</asp:RequiredFieldValidator>
            <asp:CustomValidator ID="CustValidGroupNameLength" runat="server" ForeColor="Red" 
               ControlToValidate="ttGroupName" 
               ErrorMessage="Имя группы не может быть менее двух символов" 
               onservervalidate="CustValidGroupNameLengthServerValidate" ValidationGroup="GroupReq">*</asp:CustomValidator>
            <asp:CustomValidator ID="CustValidGroupNameExist" runat="server" ForeColor="Red" 
               ErrorMessage="Такая группа уже существует" 
               onservervalidate="CustValidGroupNameExistServerValidate" ValidationGroup="GroupReq">*</asp:CustomValidator>

         </td>
         <td><asp:Image ID="imgIcon" runat="server" Width="125px" /></td>
      </tr>

      <tr>
         <td>
            Описание:
         </td>
         <td><asp:TextBox ID="ttDescription" runat="server" Height="108px" Width="289px" TextMode="MultiLine"></asp:TextBox></td>
      </tr>

      <tr>
        <td>Иконка:</td>
        <td align="center"><asp:FileUpload ID="IconUpload" runat="server" />
           <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ForeColor="Red" 
              ErrorMessage="Иконка не выбрана" ValidationGroup="Icon" 
              ControlToValidate="IconUpload">*</asp:RequiredFieldValidator>
         </td>
         <td>
            <asp:Label ID="lblNewPhoto" runat="server" Text=""></asp:Label>
         </td>
      </tr>

      <tr>
        <td>Имя иконки:</td>
        <td><asp:Label ID="lblIconPath" runat="server" Text=""></asp:Label></td>
        <td align="center">
            <asp:Button ID="btnSaveIcon" runat="server" Text="Upload" CssClass="aspBtn" Width="70" Height="30"  BorderWidth="1" 
            OnClientClick="return confirm('Вы действительно хотите перезаписать эту иконку? \n        (Предыдущая иконка будет удалена!)')"
            CommandName="Upload" ValidationGroup="Icon"
            OnClick="BtnSaveIconClick"  />
        </td>
      </tr>

      <tr>
         <td align="center" colspan="5">
<%--        <asp:Button ID="btnSaveGroup" runat="server" Text="SAVE" onclick="BtnSaveGroupClick" ValidationGroup="GroupReq" />
            <asp:Button ID="btnCancel" runat="server" Text="CANCEL" PostBackUrl="~/GroupList.aspx" ValidationGroup="Non"/>--%>

            <asp:Button ID="btnSaveGroup" runat="server" Text="Save" CssClass="aspBtn" Width="70" Height="30"  BorderWidth="1" onclick="BtnSaveGroupClick" ValidationGroup="GroupReq" />
            <asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="aspBtn" 
               Width="70" Height="30"  BorderWidth="1" ValidationGroup="Non" 
               onclick="BtnCancelClick" />

         </td>
      </tr>
   </table>


				</div>
        	</div><!-- end #formSection -->

</asp:Content>
